package com.example.demo.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.demo.entity.Product;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ProductMapper extends BaseMapper<Product> {
    
    /**
     * 查询可用的商品
     */
    @Select("SELECT * FROM products WHERE is_available = true AND stock > 0")
    List<Product> findAvailableProducts();
    /**
     * 查询可用的商品
     */
    @Select("SELECT * FROM products ")
    List<Product> all();
    @Select("SELECT * FROM products where is_pet=#{a}")
    List<Product> allt(int a);
    @Select("SELECT * FROM products where is_pet=#{a}")
    List<Product> allf(int a);
}